import {proxy} from "@@/exports";
import {AutoReplyVO} from "@/services/AutoReplyService";

interface AutoReplyModelType {
    autoReply?: AutoReplyVO;
    updateModalState: boolean;
}

const state = proxy<AutoReplyModelType>({
    autoReply: undefined,
    updateModalState: false,
})

const actions = {
    /**
     * 设置修改模态框状态
     * @param modalState 状态
     */
    setUpdateModalState(modalState: boolean) {
        state.updateModalState = modalState
    },
    /**
     * 打开模态框
     * @param modalState
     * @param autoReply
     */
    openUpdateModal(modalState: boolean, autoReply?: AutoReplyVO) {
        state.autoReply = autoReply
        state.updateModalState = modalState
    },
};


export const AutoReplyModel = {state, actions}